package com.ldc.framework.viewmodel

import com.ldc.commonlibs.common.ViewModelBase
import com.ldc.framework.api.FrameworkServer

class FrameworkViewModelBase : ViewModelBase() {
    private val server: FrameworkServer =
        getServer(FrameworkServer::class.java)


    // banner 列表
    fun bannerList() = launchUi {
        server.bannerList()
    }


    // 首页文章
    fun topArticleList(page: Int = 1) = launchUi {
        server.articleList(page)
    }

    // 体系列表
    fun systemList() = launchUi {
        server.systemList()
    }

    fun articleList(
        page: Int = 1,
        cid: String
    ) = launchUi {
        server.articleList(page, cid)
    }


    fun projectClassList() = launchUi {
        server.projectClassList()
    }

    // 项目列表
    fun projectList(
        page: Int,
        cid: String
    ) = launchUi { server.projectList(page, cid) }


    // 导航列表
    fun NaviJson() = launchUi {
        server.NaviJson()
    }

    // 问答
    fun wenDa(page: Int = 0) = launchUi { server.WenDa(page) }


    //公众号
    fun WxList() = launchUi { server.wxarticle() }

    // 获取用户信息
    fun userInfo() = launchUi { server.userInfo() }

    // rank列表排行
    fun rankList(p: Int = 1) = launchUi { server.rankList(p) }

    // rank列表排行
    fun coinList(p: Int = 1) = launchUi { server.coinList(p) }

    // 收藏列表
    fun collectList(p: Int) = launchUi { server.collectList(p) }


    fun collect(id: String) = launchUi {
        server.collect(id)
    }

    fun uncollect(id: String, originId: String) = launchUi {
        server.uncollect(id, originId)
    }

    fun uncollectOriginId(id: String) = launchUi {
        server.uncollect_originId(id)
    }


    fun hotkey() = launchUi {
        server.hotkey()
    }

    fun queryKey(page: Int = 0, key: String = "") = launchUi {
        server.queryKey(page, key)
    }

}